<?php defined('_JEXEC') or die('Restricted access');
/**
 * @package    indie-bookstore
 * @subpackage bookstore
 * @author David Neimeyer davidneimeyer@gmail.com
 * administrator/components/com_bookstore/views/bookstore/tmpl/default.php
 * @link http://indie-bookstore.googlecode.com/
 * @license    GNU/GPL
 * 
 */

$user 	=& JFactory::getUser();

//Ordering allowed ?
$ordering = ($this->lists['order'] == 'a.ordering');

JHTML::_('behavior.tooltip');
?>
<form action="<?php echo $this->request_url; ?>" method="post" name="adminForm">
<?php

	?>
	<div id="cpanel">
		<?php
		$link = 'index.php?option=com_bookstore&amp;controller=locator&amp;view=locator';
		$this->quickiconButton( $link, 'icon-48-component.png', JText::_( 'Product Locator' ) );
		
		$link = 'index.php?option=com_bookstore&amp;controller=staff';//&amp;view=staff
		$this->quickiconButton( $link, 'icon-48-user.png', JText::_( 'Staff Component' ) );
		
		$user = &JFactory::getUser();
		
		/**
		 * @review i guess 24+ is administrator group? is this the best logic for this?
		 */
		if ( $user->get('gid') > 24 ) {
			$link = 'index.php?option=com_bookstore&amp;controller=analytics&amp;view=analytics';
			$this->quickiconButton( $link, 'icon-48-component.png', JText::_( 'Store Analytics' ) );
		
			$link = 'index.php?option=com_bookstore';
			$this->quickiconButton( $link, 'icon-48-config.png', JText::_( 'Bookstore Configuration' ) );
		}
		?>
	</div>
<?php
/*
<div id="editcell">
	<table class="adminlist">
	<thead>
		<tr>
			<th width="5">
				<?php echo JText::_( 'NUM' ); ?>
			</th>
			<th width="20">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
			</th>
			<th class="title">
				<?php echo JHTML::_('grid.sort',  'Title', 'a.title', $this->lists['order_Dir'], $this->lists['order'] ); ?>

			</th>
			<th width="5%" nowrap="nowrap">
				<?php echo JHTML::_('grid.sort',  'Published', 'a.published', $this->lists['order_Dir'], $this->lists['order'] ); ?>
			</th>
			<th width="80" nowrap="nowrap">
				<?php echo JHTML::_('grid.sort',  'Order', 'a.ordering', $this->lists['order_Dir'], $this->lists['order'] ); ?>
		 	</th>
			<th width="1%">
				<?php echo JHTML::_('grid.order',  $this->items ); ?>
			</th>
			<th width="5%" nowrap="nowrap">
				<?php echo JHTML::_('grid.sort',  'ID', 'a.id', $this->lists['order_Dir'], $this->lists['order'] ); ?>
			</th>
			<th width="25%"  class="title">
				<?php echo JHTML::_('grid.sort',  'Category', 'category', $this->lists['order_Dir'], $this->lists['order'] ); ?>
			</th>
			<th width="5%">
				<?php echo JHTML::_('grid.sort',  'Hits', 'a.hits', $this->lists['order_Dir'], $this->lists['order'] ); ?>
			</th>
		</tr>
	</thead>
	<tfoot>
		<tr>
			<td colspan="9">
				<?php echo $this->pagination->getListFooter(); ?>
			</td>
		</tr>
	</tfoot>
	<tbody>
	<?php
	$k = 0;
	for ($i=0, $n=count( $this->items ); $i < $n; $i++)
	{
		$row = &$this->items[$i];

		$link 	= JRoute::_( 'index.php?option=com_bookstore&controller=bookstore&task=edit&cid[]='. $row->id );

		$checked 	= JHTML::_('grid.checkedout',   $row, $i );
		$published 	= JHTML::_('grid.published', $row, $i );

		$row->cat_link 	= JRoute::_( 'index.php?option=com_categories&section=com_bookstore&task=edit&id='. $row->catid );
		?>
		<tr class="<?php echo "row$k"; ?>">
			<td>
				<?php echo $this->pagination->getRowOffset( $i ); ?>
			</td>
			<td>
				<?php echo $checked; ?>
			</td>
			<td>
				<?php
				if (  JTable::isCheckedOut($this->user->get ('id'), $row->checked_out ) ) {
					echo $row->title;
				} else {
				?>
					<a href="<?php echo $link; ?>" title="<?php echo JText::_( 'Edit bookstore' ); ?>">
						<?php echo $row->title; ?></a>
				<?php
				}
				?>
			</td>
			<td align="center">
				<?php echo $published;?>
			</td>
			<td class="order" colspan="2">
				<span><?php echo $this->pagination->orderUpIcon( $i, ($row->catid == @$this->items[$i-1]->catid),'orderup', 'Move Up', $ordering ); ?></span>
				<span><?php echo $this->pagination->orderDownIcon( $i, $n, ($row->catid == @$this->items[$i+1]->catid), 'orderdown', 'Move Down', $ordering ); ?></span>
				<?php $disabled = $ordering ?  '' : 'disabled="disabled"'; ?>
				<input type="text" name="order[]" size="5" value="<?php echo $row->ordering;?>" <?php echo $disabled ?> class="text_area" style="text-align: center" />
			</td>
			<td align="center">
				<?php echo $row->id; ?>
			</td>
			<td>
				<a href="<?php echo $row->cat_link; ?>" title="<?php echo JText::_( 'Edit Category' ); ?>">
				<?php echo $row->category; ?>
				</a>
			</td>
			<td align="center">
				<?php echo $row->hits; ?>
			</td>
		</tr>
		<?php
		$k = 1 - $k;
	}
	?>
	</tbody>
	</table>
</div>
*/
?>
<input type="hidden" name="controller" value="" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="filter_order" value="<?php echo $this->lists['order']; ?>" />
<input type="hidden" name="filter_order_Dir" value="" />
</form>